<?php
	class Sql{
		public $conn;
		public $dbname="student";
		public $username="root";
		public $password="root";
		public $host="localhost";
		public function __construct(){
			
			$this->conn=mysqli_connect($this->host,$this->username,$this->password,$this->dbname);
			if(!$this->conn){
				die("连接失败".mysqli_error());
			}
		}
		
		public function select($sql){
			$re=mysqli_query($this->conn,$sql);
			$row=mysqli_fetch_all($re,MYSQLI_ASSOC);
			echo '<pre>';
			var_dump($row);
		}

		public function zsgc($sql){
			$re=mysqli_query($this->conn,$sql);
			if($re){
				echo '操作成功';
			}
			else{
				echo '操作失败';
			}
		}
	}
	
	$stu1=new Sql;
//	$stu1->select();
//	$stu1->zsgc();
?>